package com.gec.it.shiro;

import com.gec.it.util.Md5Util;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.credential.CredentialsMatcher;

public class MyCredentialsMatcher implements CredentialsMatcher {
    @Override
    public boolean doCredentialsMatch(AuthenticationToken authenticationToken, AuthenticationInfo authenticationInfo) {
        String input=new String((char[])authenticationToken.getCredentials());
        String upwd= Md5Util.digest(input);
        String dbpwd= (String) authenticationInfo.getCredentials();
        return upwd.equalsIgnoreCase(dbpwd);
    }
}
